<?php
include_once("common.php"); // session start for page security 
?>

<html>

<head>

<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>Sebastian's Enterprise</title>
<script>
function chkaccept()
{
if(window.frm.chk.checked==true)
{
window.print();
alert("Printing the information page for future usage.");
return true;
}
else
{
alert("You have not accepted that the information entered by you is correct! To accept, check the box given at bottom of the form.");
return false;
}
}
</script>
</head>

<body bgcolor="" background="">

<TABLE border=1 cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#000000" bordercolor="#000000" width="100%" height="100%">

<TR>
	<TD width="100%" height="100%">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
		  <tr>
			<td width="150" height="150"><img border="0" src="images/king_logo.gif" width="150" height="150"></td>
			<td width="532" height="150">
			  <p align="center"><font face="Arial" size="6">King of Enterprises</font></p>
			  <p align="center"><font face="Lucida Handwriting" size="3"></font></td>
			<td width="201" height="150"></td>
		  </tr>
		  <tr>
			<td width="100%" height="437" colspan="3">
			  <table border="1" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#FFFFFF" height="100%" bordercolordark="#000000" bordercolor="#000000">
				  <td width="82%" valign=top align=center>&nbsp;<P>
				  <?php
	include_once("ClsSebent/config.php");
	$action=$_REQUEST['action'];
	$uid=$_REQUEST['uid'];
	if($action=="Register"){
		if($uid==''){echo"<h4><font color=\"red\">Mandatory fields can't be left empty!!</font></h4>"; exit;}
		$sql="SELECT * FROM reseller WHERE uid='$uid'";

		$result = mysql_query($sql);
		if($row=mysql_fetch_array($result))
			{
			$msg="The User ID is not available, please choose another ID.";			
			}
		else{
		$date=date("Y-m-d");
		$uid=mysql_escape_string($_REQUEST['uid']);
		$pwd=mysql_escape_string($_REQUEST['pwd']);
		$pwd_rep=mysql_escape_string($_REQUEST['pwd_rep']);
		$title=mysql_escape_string($_REQUEST['title']);
		$fname=mysql_escape_string($_REQUEST['fname']);
		$mname=mysql_escape_string($_REQUEST['mname']);
		$lname=mysql_escape_string($_REQUEST['lname']);
		$email=mysql_escape_string($_REQUEST['email']);
		$email2=mysql_escape_string($_REQUEST['email2']);
		$DOB=$D."/".$M."/".$Y;
		$phone_no=mysql_escape_string($_REQUEST['phone_no']);
		$business_no=mysql_escape_string($_REQUEST['business_no']);
		$mobile_no=mysql_escape_string($_REQUEST['mobile_no']);
		$business_name=mysql_escape_string($_REQUEST['business_name']);
		$business_type=mysql_escape_string($_REQUEST['business_type']);
		$emp_pos=mysql_escape_string($_REQUEST['emp_pos']);
		$address1=mysql_escape_string($_REQUEST['address1']);
		$address2=mysql_escape_string($_REQUEST['address2']);
		$suite=mysql_escape_string($_REQUEST['suite']);
		$URL=mysql_escape_string($_REQUEST['URL']);
		$tax_id=mysql_escape_string($_REQUEST['tax_id']);
		$city=mysql_escape_string($_REQUEST['city']);
		$abbr=mysql_escape_string($_REQUEST['abbr']);
		$province=mysql_escape_string($_REQUEST['province']);
		$country=mysql_escape_string($_REQUEST['country']);
		if($ozip!="")
		$zip=mysql_escape_string($_REQUEST['ozip']);	
		else 
		$zip=mysql_escape_string($_REQUEST['zipval']);
		if($uid =="" ||  $pwd =="" ||  $fname=="" ||  $lname=="" ||  $email=="" ||  $DOB=="" ||  $phone_no=="" ||  $business_name=="" || $address1=="" || $abbr=="" || $city=="" ||  $province=="" ||  $country=="")
		{echo"<h4><font color=\"red\">Mandatory fields can't be left empty!!</font></h4>";}
		else if($email!=$email2)
		{echo"<h4><font color=\"red\">Email id's do not match!!</font></h4>";
		}
		else if($pwd!=$pwd_rep)
		{echo"<h4><font color=\"red\">Password not confirmed!!</font></h4>";
		}
		else{
		$sql="INSERT INTO `reseller` ( `uid` , `pwd` , `title` , `fname`, `mname`, `lname`, `email`, `DOB`, `phone_no`, `business_no` , `mobile_no`, `business_name`, `business_type`, `emp_pos`, `address1`, `address2`, `suite`, `URL`, `tax_id`, `city`, `state_abbr`,`province`, `country`, `zip`, `reg_dt` , `join_dt` , `subs_type` , `active` , `site_id`, `updates`, `parent_id`) VALUES ('$uid' , '$pwd' , '$title' , '$fname', '$mname', '$lname', '$email', '$DOB', '$phone_no', '$business_no' , '$mobile_no', '$business_name', '$business_type', '$emp_pos', '$address1', '$address2', '$suite', '$URL', '$tax_id', '$city', '$abbr', '$province', '$country', '$zip', '$date', '', 'R', 'N', '0','Y', '$parent_id')";
		//echo $sql;
		mysql_query($sql);
		//UPDATE/INSERT VALUES IN ZIPCODES TABLE.
		//echo "OZIP : ".$ozip;
		if($_REQUEST['lattitude']=="")$lattitude=0;
		if($_REQUEST['longitude']=="")$longitude=0;
		if($ozip!="")//New zipcode entered.
		{
		//echo "INSERT";
		$zqur="INSERT INTO zipcode values('$ozip','$abbr',$lattitude,$longitude,'$city','$province')";
		//echo $zqur;
		mysql_query($zqur);		
		}
		else//Update existing information.
		{//echo "UPDATE";
		$zqur="Update zipcode SET `state abbreviation`='".$abbr."', `latitude`=".$lattitude.", `longitude`=".$longitude.", `city`='".$city."', `state`='".$province."' where `zip code`='".$zipval."'";
		//echo $zqur;
		mysql_query($zqur);
		
		//IF AUTOPILOT ON.
		$autoqry="Select auto_pilot from reseller where site_id=101";
		$autores=mysql_query($autoqry);
		$autorow=mysql_fetch_array($autores);
		$autoP=$autorow['auto_pilot'];
		if($autoP=='Y')
		{
		auto_pilot_activation($uid);
		}//IF AUTO PILOT THEN ACTIVATE THE RESELLR IMMEDIATELY.
		
		}?>
				
		<?php if($autoP=='Y')
		{?>
		<H4><FONT COLOR=red>Registration completed successfully!<BR><BR>
	You can Login to your website at: <a href="http://www.king.hostingcorp.biz/cpanel.html">Login Window</a><BR>Your User Id : <?php echo $uid;?> and Password is: <?php echo $pwd;?>. <BR>
	Please note down this link for further use: http://www.king.hostingcorp.biz/cpanel.html<br>
	Please let the status bar processing finish. This is required for a successfull registration and then Log In.
		<?php }
		else {?>
				      <H4><FONT COLOR=red>Registration completed successfully!<BR><BR>
				      Our representative will contact you shortly. You can test the website functionality with the link given below.<BR>
				      <a href="http://www.king.hostingcorp.biz/cpanel.php?uid=Test&pwd=Test">http://www.king.hostingcorp.biz/cpanel.php?uid=Test&pwd=Test</a></font></H4><BR>
			<?php }?>
									</td>
							</tr>
						  </table>
						</td>
					  </tr>
					  <tr>
						<td width="100%" height="24" colspan="3" align="center">
						  <p align="center"><font face="Verdana" size="2">Copyright 2005 <a href="http://www.kingofenterprises.com">Sebastian's
						  Enterprise</a></font></td>
					  </tr>
					</table>
				</TD>
			</TR>
			</TABLE>
			<?php } 			
		}//Else of if.
	}//top if
?>
<CENTER>
<H2> Reseller Registration Form</H2><BR><?php echo $msg; ?>
(Fields with <font color="#FF0000">*</font> are mandatory)
<form enctype="multipart/form-data" name=frm method="post" onSubmit="javascript: return chkaccept();">
<input type="hidden" name="parent_id" value="<?php echo $_SESSION['SITE_ID'];?>">
<TABLE width="661">
<tr><td width="152">User ID<font color="#FF0000">*</font></td>
<td colspan="2"><input name=uid value="<?php echo $uid; ?>" size=15 maxlength=15></td>
<td rowspan="6" valign="top"><div align="center"></div></td>
</tr>
<tr><td>Password<font color="#FF0000">*</font>  </td><td colspan="2"><input type=password name=pwd size=15 maxlength=15></td>
  </tr>
<tr><td>Repeat Password<font color="#FF0000">*</font>  </td><td colspan="2"><input type=password name=pwd_rep size=15 maxlength=15></td>
  </tr>
<tr><td>Title </td><td colspan="2"><input name=title value="<?php echo $fname; ?>" size=5 maxlength=50></td>
  </tr>
<tr><td>First Name<font color="#FF0000">*</font> </td><td colspan="2"><input name=fname value="<?php echo $fname; ?>" size=50 maxlength=50></td>
  </tr>
<tr><td>Middle Name </td><td colspan="2"><input name=mname value="<?php echo $mname; ?>" size=50 maxlength=50></td>
  </tr>
<tr><td>Last Name<font color="#FF0000">*</font> </td><td colspan="2"><input name=lname value="<?php echo $lname; ?>" size=50 maxlength=50></td><td>&nbsp;</td>
  </tr>
<tr><td>Email address<font color="#FF0000">*</font> </td><td colspan="2"><input name=email value="<?php echo $email; ?>" size=50 maxlength=100></td><td></td>
  </tr>
<tr>
  <td>Confirm Email address<font color="#FF0000">*</font></td>
  <td colspan="2"><input name=email2 size=50 value="<?php echo $email2; ?>" maxlength=100></td><td></td>
  </tr>
<tr>
  <td>Date Of Birth<font color="#FF0000">*</font> </td>
  <td colspan="2"><select name="D">
<option selected="<?php echo $D;?>"><?php echo $D;?></option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select name="M">
<option selected="<?php echo $M;?>"><?php echo $M;?></option>
<option value="01">jan</option>
<option value="02">feb</option>
<option value="03">mar</option>
<option value="04">apr</option>
<option value="05">may</option>
<option value="06">jun</option>
<option value="07">jul</option>
<option value="08">aug</option>
<option value="09">sep</option>
<option value="10">oct</option>
<option value="11">nov</option>
<option value="12">dec</option>
</select>
<select name="Y">
<option selected="<?php echo $Y;?>"><?php echo $Y;?></option>
<?php
$yr=date("Y");
$i=$yr-100;
while($i<($yr-15)){?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php $i++;} ?>
</select>  </td><td></td>
  </tr>
<tr><td>Phone number<font color="#FF0000">*</font> </td><td colspan="3"><input name=phone_no value="<?php echo $phone_no; ?>" size=20 maxlength=20></td>
</tr>
<tr><td>Business Phone </td><td colspan="2"><input name=business_no value="<?php echo $business_no; ?>" size=20 maxlength=20></td><td></td>
  </tr>
<tr><td>Mobile Phone </td><td colspan="2"><input name=mobile_no value="<?php echo $mobile_no; ?>" size=20 maxlength=20></td><td></td>
  </tr>
<tr><td>Business Name<font color="#FF0000">*</font> </td><td colspan="2"><input name=business_name value="<?php echo $business_name; ?>" size=20 maxlength=50></td><td></td>
  </tr>
<tr><td>Type of Business </td><td colspan="2"><input name=business_type value="<?php echo $business_type; ?>" size=20 maxlength=50></td><td></td>
  </tr>
<tr><td>Employment Position </td><td colspan="2"><input name=emp_pos value="<?php echo $emp_pos; ?>" size=20 maxlength=50></td><td></td>
  </tr>
<tr><td>Street Address1<font color="#FF0000">*</font> </td><td colspan="3"><input name=address1 value="<?php echo $address1; ?>" size=50 maxlength=255></td></tr>
<tr><td>Street Address2 </td><td colspan="3"><input name=address2 value="<?php echo $address2; ?>" size=50 maxlength=255></td></tr>
<tr><td>Apartment or Suite# </td><td colspan="3"><input name=suite value="<?php echo $suite; ?>" size=20 maxlength=100></td></tr>
<tr>
  <td>URL</td>
  <td colspan="3"><input name=URL value="<?php echo $URL;?>" size=50 maxlength=100>    
     (i.e. www.domainName.com) </td>
</tr>
<tr>
  <td>Tax/EIN/SS ID# </td>
  <td colspan="3"><input name=tax_id value="<?php echo $tax_id; ?>" size=20 maxlength=100></td>
</tr>
<tr>
  <td>Zip code/Mailing code<font color="#FF0000">*</font> </td>
  <td colspan="3">
  <input type="text" name="zipval" size="10" onBlur="javascript: var1= document.frm.zipval.value; document.frm.zipval.focus; window.open('fillvalues.php?zip='+var1,'','width=0,height=0'); window.focus();" onKeyPress="javascript: if(even.keycode==13){ window.open('fillvalues.php?zip=' + document.frm.zipval.value,'','width=0,height=0'); document.frm.zipval.focus;}">
  <option selcted=<?php //echo $zrow["zip code"];?>><?php //echo $zrow["zip code"];?></option>
  <?php /*
  $zq="select * from zipcode order by `zip code`";
  $zr=mysql_query($zq);
  while($zrow=mysql_fetch_array($zr))
  {*/?>
  <option value="<?php //echo $zrow["zip code"];?>"><?php //echo $zrow["zip code"];?></option>
  <?php
  //}
  ?>
    </select>
     Other: 
     <input name=ozip value="<?php echo $ozip; ?>" size=10 maxlength=6 ></td>
  </tr>
<tr>
  <td>State Abbriviation<font color="#FF0000">*</font> </td>
  <td colspan="3"><input name=abbr value="<?php echo $abbr; ?>" size=20 maxlength=100></td>
  </tr>
<tr><td>City<font color="#FF0000">*</font> </td><td><input name=city value="<?php echo $city; ?>" size=20 maxlength=100></td>
  <td>Longitute</td>
  <td width="175"><input name=longitude value="<?php echo $longitude; ?>" size=20 maxlength=100></td>
</tr>
<tr><td>State or Province<font color="#FF0000">*</font> </td><td width="178"><input name=province value="<?php echo $province; ?>" size=20 maxlength=100></td>
  <td width="136">Lattitude</td>
  <td><input name=lattitude value="<?php echo $lattitude; ?>" size=20 maxlength=100></td>
</tr>
<tr><td>Country<font color="#FF0000">*</font> </td><td colspan="3">
<select name=country >
<option selected="<?php echo $country; ?>" ><?php echo $country; ?></option>
<?php
$cq="select * from country";
$cr=mysql_query($cq);
while($crs=mysql_fetch_array($cr))
{?>
<option value="<?php echo $crs["c_name"];?>"><?php echo $crs["c_name"];?></option>
<?php
}
?>
</select>
</td></tr>
<tr><td>&nbsp;</td>
<td colspan="3"><input name="chk" type="checkbox" id="chk" >
  I accept that all the information entered here by me is correct. </td>
</tr>
<td colspan=4 align=center><input type=submit name=action value=Register > <input type=reset value=Reset></TD>
</TR>
</TABLE>
</form>
</CENTER>
				</td>
				</tr>
			  </table>
			</td>
		  </tr>
		  <tr>
			<td width="100%" height="24" colspan="3" align="center">
			  <p align="center"><font face="Verdana" size="2">Copyright 2005 <a href="http://www.kingofenterprises.com">Sebastian's
			  Enterprise</a></font></td>
		  </tr>
		</table>
	</TD>
</TR>
</TABLE>
</body>
</html>
